package com.example.foodsy.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.foodsy.entity.City;
import com.example.foodsy.mapper.CityMapper;
import com.example.foodsy.service.CityService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 市行政区域信息表 服务实现类
 * </p>
 *
 * @author cgc
 * @since 2025-09-23
 */
@Service
public class CityServiceImpl extends ServiceImpl<CityMapper, City> implements CityService {

    @Autowired
    private CityMapper cityMapper;
    //根据省份ID查询城市列表
    @Override
    public List<City> listByProvinceId(Long provId) {
        LambdaQueryWrapper<City> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(City::getProvId, provId); // 按省份ID筛选
        return cityMapper.selectList(wrapper);
    }
}
